int missingNumber(int *nums, int numsSize)
{
    int sum = 0;
    int *p = nums;
    for(int i = 0; i < numsSize; ++i) {
        sum += *p;
        p++;
    }
    if(numsSize % 2) {
        return (numsSize + 1) / 2 * numsSize - sum;
    } else {
        return numsSize / 2 * (numsSize + 1) - sum;
    }
}